# !usr/bin/env python3
# -*- encoding: utf-8 -*- 
#前面几章的集合
import re
import os

for i in range(0,10,2):
    print("i",i)

print(i)

def calSqr(val):
    epsilon = 0.01
    ans = 0
    guesses = 0
    while abs(ans**2-val)>epsilon and ans<=val:
        ans+=epsilon**2
        guesses+=1
    
    print("guesses",guesses)
    print("ans",ans)
    if ans**2<val:
        print("找到{0}的平方根近似值{1},平方值{2}".format(val,ans,ans**2))
    

#calSqr(16)
#reObj = re.compile(r"console\.log.+?\)[^\(\)]*(((?'-Open'\()[^\(\)]*)+((?'-Open'\()[^\(\)]*)+)*(?(Open)(?!))\)")
reObj = re.compile(r"console.log\(.*?\)")
with open("code.txt","r",encoding="utf8") as f:
    content = f.read()
    content = 'GS.item.select(i);console.log("... 搜索物品表耗时:",t.getTimer()-s," 毫秒")'
    #print(content)
    obj = reObj.search(content)
    print("search",obj)
    if obj:
        print("group 11",obj.group())
        print(obj.groups())
